﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Seasons : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void GenerateSeasons(Season selectedSeason, string href)
    {
        List<Season> seasons = DataBase.Seasons.GetSeasons();

        string normalWeek = "season";
        string selectedWeek = "selectedSeason";

        foreach (var s in seasons)
        {
            string cssClass = (selectedSeason.StartYear == s.StartYear ? selectedWeek : normalWeek);
            seasonNumbers.Controls.Add(new LiteralControl("<a href=\"" + href + (href.Contains('?') ? '&' : '?') + "Season=" + s.ID + "\" class=\"" + cssClass + "\">"));
            seasonNumbers.Controls.Add(new LiteralControl(s.StartYear.ToString()));
            seasonNumbers.Controls.Add(new LiteralControl("</a>"));
        }
    }
}